
def main():
    D_INPUT = True
    
    if D_INPUT:
        str = raw_input()
    else:
        str = "qweqweASDFGHASDFGASasdfghas123"

    s0 = 0
    l0 = 1
    
    s = 0
    i = 1
    while l0 < len(str)-s :
        for j in xrange(s,s+i) :
            if s+i == len(str) or str[j] == str[s+i] :
                
                if i > l0 :
                    s0 = s
                    l0 = i               
                
                i -= j-s
                s = j+1
                break
        else :
            i += 1
    
    print str[s0:s0+l0]

main()